<%--
  Created by IntelliJ IDEA.
  User: cc
  Date: 2017/8/14
  Time: 11:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="${ctp}/assets/vendor/layui/css/layui.css"/>
    <script src="${ctp}/assets/vendor/jQuery/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctp}/assets/vendor/layer/layer.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctp}/assets/vendor/layui/layui.js"></script>
</head>
<body>
<div>
    <form>
        输入博客id:
        <input type="text" id="bolgId">
        <button id="searchBlog" type="button">查阅博客</button>
    </form>

</div>
<div id="showBolg">
</div>
<script type="text/javascript">
    $("#searchBlog").click(function () {
        $("#showBolg").empty();
        var id = $("#bolgId").val();
        console.log("id="+id);

        $.ajax({
            type:"post",
            data: "id=" + id,
            url:"/youu-restapi/blog/getBlog",
            success : function(data){
                console.log("data="+data);
                layer.open({
                    type: 2,
                    anim:1,
                    title: '显示博文',
                    shadeClose: true,
                    shade: false,
                    area: ['61.8%', '61.8%'],
                    maxmin: true,
                    content: "/youu-restapi"+data, //iframe的url

                    btn: ['关闭'],
                    yes: function (index,layero) {
                        layer.close(index);
                    },

                });

            },
            error:function (data) {
                console.log(data)
                alert("失败");
            }
        })
    })

</script>
</body>
</html>
